<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- autocomplete='off' 清除浏览器输入框的记录（清除内存） -->
    <input type="text" id="user" placeholder="请输入用户名">

    <script>
        let userEle = document.getElementById('user');

        // 绑定获取焦点
        userEle.addEventListener('focus', function () {
            console.log('ZZC爱打CSGO');
        });

        // 绑定失去焦点
        userEle.addEventListener('blur', function () {
            console.log('ZZC天天打CSGO');
        });

        // 绑定键盘按下并抬起的事件
        userEle.addEventListener('keyup', function (even) {
            // even事件对象
            // console.log(even);
            console.log('keyup', even.code, even.keyCode);
        });
    </script>
</body>

</html>